TARGET = Kruskal
SOURCES = $(wildcard *.c)
HEADERS = $(wildcard *.h)
OBJECTS = $(SOURCES:.c=.o)


.PHONY : clean dist


LIBS = #-lefence

CC = gcc

CFLAGS = -g -Wall -ansi -pedantic \
-Waggregate-return \
-Wbad-function-cast \
-Wcast-qual \
-Wcast-align \
#-Wc++-compat \
-Wdeclaration-after-statement \
-Wendif-labels \
-Werror \
-Wextra \
-Wfloat-equal \
-Wimport \
-Winline \
-Winvalid-pch \
-Wlong-long \
-Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-format-attribute \
-Wmissing-noreturn \
-Wmissing-prototypes \
-Wnested-externs \
#-Wno-attributes \
-Wold-style-definition \
-Wpacked \
-Wpointer-arith \
-Wpointer-sign \
-Wredundant-decls \
-Wshadow \
-Wsign-compare \
#-Wstack-protector \
-Wstrict-prototypes \
-Wundef \
-Wunreachable-code \
#-Wunsafe-loop-optimizations \
-Wunused-macros \
-Wvariadic-macros \
#-Wvolatile-register-var \
-Wwrite-strings \
-DNDEBUG
#-Wtraditional \
#-Wconversion \
#-Wpadded \

all: $(TARGET)

clean:
	rm -f $(TARGET) $(OBJECTS) .depend

distclean:
	rm -f $(TARGET) $(OBJECTS) .depend *~ *.tgz

-include .depend

.depend: $(SOURCES) $(HEADERS)
	gcc -MM $(SOURCES) $(HEADERS) >.depend

$(TARGET): $(OBJECTS) 
	$(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LIBS)

dist:
	tar -czvf $(TARGET).tar.gz $(SOURCES) $(HEADERS) Makefile

